package com.ibm.testbed.common.history;

import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.MethodInvocation;

public class ElementChange implements IElementChangedListener {

	
	private ASTVisitor visitor=new ASTVisitor() {
		
		
		
		public void endVisit(MethodInvocation node) {
			// default implementation: do nothing
			System.out.println(node.getStartPosition());
			System.out.println(node.getLength());
			System.out.println(node.toString());
			System.out.println(node.toString().length());
		}
		
	};
	
	@Override
	public void elementChanged(ElementChangedEvent event) {

		CompilationUnit cu= event.getDelta().getCompilationUnitAST();
		if(cu!=null)cu.accept(visitor);
		
	}

}
